package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.*;
import com.heima.wemedia.service.WmCommentManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/v1/comment/manage")
public class WmCommentManageController {

    @Autowired
    private WmCommentManageService wmCommentManageService;

    /**
     * 评论管理查询
     * @return
     */
    @PostMapping("find_news_comments")
    public ResponseResult findNewsComments(@RequestBody WmFindNewsCommentDto dto){
        return wmCommentManageService.findNewsComments(dto);
    }

    /**
     * 打开/关闭评论
     * @return
     */
    @PostMapping("update_comment_status")
    public ResponseResult updateCommentStatus(@RequestBody WmUpdateCommentStatusDto dto){
        return wmCommentManageService.updateCommentStatus(dto);
    }

    /**
     * 查看文章评论详情
     * @return
     */
    @PostMapping("list")
    public ResponseResult list(@RequestBody WmCommentListDto dto){
        return wmCommentManageService.getCommentList(dto);
    }

    /**
     * 作者回复评论
     * @return
     */
    @PostMapping("comment_repay")
    public ResponseResult commentRepay(@RequestBody WmCommentRepayDto dto){
        return wmCommentManageService.commentRepay(dto);
    }

    /**
     * 作者点赞评论
     * @param dto
     * @return
     */
    @PostMapping("like")
    public ResponseResult like(@RequestBody WmCommentLikeDto dto){
        return wmCommentManageService.like(dto);
    }

}
